﻿using System;
using System.Text;
using System.Collections.Generic;

namespace LMD.Lib.DataClass
{
    [Serializable]
    public class NewsFeedData
    {
        public DateTime dtmDate = DateTime.MinValue;

        public int ID = -1;
        public int iCustomerId = -1;
        public int iSourceId = -1;
        public int iCommentCount = 0;

        public String sxTitle = String.Empty;
        public String sxContent = String.Empty;
        public String sxCustomerName = String.Empty;
        public String sxUserId_Poster = String.Empty;
        public String sxUserName_Poster = String.Empty;
        public String sxUserId_Target = String.Empty;
        public String sxUserName_Target = String.Empty;
        public String sxSourceName = String.Empty;
        public String sxSourceURL = String.Empty;

        public NewsFeedDataType Type;

        private Dictionary<String, String> p_dicMisc = new Dictionary<String,String>();

        public void AddCustomData(String key, String value)
        {
            if (p_dicMisc.ContainsKey(key))
                p_dicMisc[key] = value;
            else
                p_dicMisc.Add(key, value);
        }

        public String GetCustomData(String key)
        {
            if (p_dicMisc.ContainsKey(key))
                return p_dicMisc[key];
            else
                return String.Empty;
        }        
    }

    [Serializable]
    public class CommentData
    {
        public DateTime dtmDate = DateTime.MinValue;

        public int ID = -1;
        public int NewsFeedID = -1;

        public String sxContent = String.Empty;
        public String sxUserId = String.Empty;
        public String sxUserName = String.Empty;

    }

    [Serializable]
    public class NotificationData
    {
        public DateTime dtmDate = DateTime.MinValue;

        public int NewsFeedID = -1;

        public bool IsRead;

        public String sxContent = String.Empty;
        public String sxUserId = String.Empty;
        public String sxUserName = String.Empty;

        private List<String> lsUser = new List<String>();

        public List<String> GetUserList()
        {
            return lsUser;
        }

        public void AddUser(String key)
        {
            if (!lsUser.Contains(key))
                lsUser.Add(key);
        }
    }

    [Serializable]
    public class UserEventData
    {
        public DateTime dtmDate = DateTime.MinValue;

        public int iCompanyId = -1;

        public String sxContent = String.Empty;
        public String sxUserId = String.Empty;
        public String sxUserName = String.Empty;
        public String sxCompanyName = String.Empty;
        public String sxURL = String.Empty;

    }

    // NEXT WILL BE OBTAINED FROM TABLE P_NEWS_FEED_DATA_TYPE
    public enum NewsFeedDataType : int
    {
        FileUpload = 1
    }
}
